package com.thinking.walle.web;

import com.thinking.walle.recommender.grouplens.GroupLensRecommender;
import org.apache.mahout.cf.taste.recommender.RecommendedItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Home Page
 *
 * @author: hebotao
 * @date: 2012-05-01 16:25
 */
public class HomePageController extends AbstractController {
    private static final Logger log = LoggerFactory.getLogger(HomePageController.class);

    private GroupLensRecommender groupLensRecommender;

    public void setGroupLensRecommender(GroupLensRecommender groupLensRecommender) {
        this.groupLensRecommender = groupLensRecommender;
    }

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
//        List<RecommendedItem> items = groupLensRecommender.recommend(1, 3);
//        log.info("Recommended: " + items.toString());
//        return new ModelAndView("home", "result", items);
        return new ModelAndView("home");
    }
}
